<template lang="pug">
  kalix-dialog.user-add(title='修改' bizKey="HotlistsTeacher" ref="kalixBizDialog" v-bind:formModel.sync="formModel" v-bind:targetURL="targetURL")
    div.el-form(slot="dialogFormSlot")
      el-form-item(label="授课教师" prop="cid" v-bind:label-width="labelWidth" )
        kalix-select(v-model="formModel.uname" appName="teacherSelect" v-bind:requestUrl="userURL"  placeholder="请选择授课教师"
        v-bind:paramObj="userParam" v-bind:defaultSelect="true" v-on:selectChange="setGroup")
</template>
<!--v-bind:rules="rules.uname"-->
<script type="text/ecmascript-6">
  import {HotlistsTeacherURL, userURL} from '../../config.toml'
  import FormModel from './model'

  export default {
    name: 'HotlistsTeacherEdit',
    data() {
      return {
        labelWidth: '150px',
        formModel: Object.assign({}, FormModel),
        rules: {
          uname: [{required: true, message: '请选择授课教师', trigger: 'change'}]
        },
        targetURL: HotlistsTeacherURL,
        userURL: userURL,
        userParam: undefined,
        name: ''
      }
    },
    methods: {
      init(dialogOption) {
        console.log('---------dialogOption------------', dialogOption)
      },
      setGroup(item) {
        console.log('---------item------------', item)
        this.formModel.uname = item.name
        this.formModel.uid = item.id
      }
    }
  }
</script>

<style scoped lang="stylus" type="text/stylus">
  .el-form
    width 50%
    margin auto
    .radio
      margin-left 150px
      margin-bottom 20px
      .el-radio
        color: #3465cb
        font-weight: bold
        font-size: 14px
</style>
